//
//  MinedoPosStore.m
//  NewPro
//
//  Created by 何荧红 on 2019/5/5.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "MinedoPosStore.h"

@implementation MinedoPosStore

#pragma mark 获取默认分润二维码图片
- (void)GetNomlWithCustomId:(NSString *)customId Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/merchant/getOrganizationQrCode",IP];
    NSDictionary *prams = @{
                            @"customId":customId
                            };
    [HttpTool postUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 获取分润二维码图片
- (void)GetNomlWithCustomId:(NSString *)customId andRate:(NSString *)rate Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/merchant/getOrganizationQrCode",IP];
    NSDictionary *prams = @{
                            @"customId":customId,
                            @"rate":rate
                            };
    [HttpTool postUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 自助开通商户
- (void)PostAddSimplePOSWithPrams:(NSDictionary *)prams Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/merchant/addSimplePOS",IP];
    [HttpTool postUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 获取用户分润等级
- (void)GetLevelWithPrams:(NSDictionary *)prams Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/trans/level",IP];
    [HttpTool getUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 认证时验证码
- (void)sendCodeWithTelephoneNumber:(NSString *)telephoneNumber Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/getAuthentication",IP];
    NSDictionary *prams = @{
                            @"telephoneNumber":telephoneNumber
                            };
    [HttpTool postUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}




@end
